#include "actor.hpp"

#include "graphics.hpp"

namespace nmc
{
	Actor::Actor(const Point& position, int width, int height)
		:Entity(),
		mPosition(position),
		mWidth(width),
		mHeight(height)
	{

	}

	Actor::~Actor()
	{

	}

	Point Actor::getPosition()
	{
		return mPosition;
	}

	void Actor::setPosition(const Point& position)
	{
		mPosition = position;
	}

	int Actor::getWidth() const
	{
		return mWidth;
	}

	void Actor::setWidth(int width)
	{
		mWidth = width;
	}

	int Actor::getHeight() const
	{
		return mHeight;
	}

	void Actor::setHeight(int height)
	{
		mHeight = height;
	}

	void Actor::drawDimension(Graphics* graphics)
	{
		graphics->setColor(Color(0x5050ff));
		graphics->drawRectangle(Rectangle(mPosition.x,
			                              mPosition.y,
										  mWidth,
										  mHeight));
		graphics->setColor(Color(0x50ff50));
		graphics->drawPoint(getBottomCollisionPoint().x, 
							getBottomCollisionPoint().y);
	}

	Point Actor::getTopCollisionPoint()
	{
		Point point(mPosition.x + mWidth / 2 - 1,
					mPosition.y);

		return point;
	}

	Point Actor::getBottomCollisionPoint()
	{
		Point point(mPosition.x + mWidth / 2 - 1,
					mPosition.y + mHeight - 1);

		return point;
	}

	Point Actor::getTopLeftPoint()
	{
		return mPosition;
	}

	Point Actor::getTopRightPoint()
	{
		Point result(mPosition.x + mWidth - 1, 
					 mPosition.y);

		return result;
	}

	Point Actor::getBottomLeftPoint()
	{
		Point result(mPosition.x, 
					 mPosition.y + mHeight - 1);

		return result;
	}

	Point Actor::getBottomRightPoint()
	{
		Point result(mPosition.x + mWidth - 1, 
					 mPosition.y + mHeight - 1);

		return result;
	}
}